package com.csun.dsms.controller;

import com.csun.dsms.comment.core.utils.wrapper.Wrapper;
import com.csun.dsms.model.domain.TicketProblemPercent;
import com.csun.dsms.model.qo.TicketProblemPercentAddQo;
import com.csun.dsms.model.qo.TicketProblemPercentUpdQo;
import com.csun.dsms.model.vo.ticketproblem.TicketProblemPercentVo;
import com.csun.dsms.service.TicketProblemPercentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Description
 *
 * @author Hongd
 * @since 2025-08-04
 */
@Slf4j
@RestController
@RequestMapping("/ticketProblemPercent")
public class TicketProblemPercentController {

    @Autowired
    private TicketProblemPercentService ticketProblemPercentService;

    @PostMapping("/add")
    public Wrapper<Void> addTicketProblemPercent(@RequestBody @Validated List<TicketProblemPercentAddQo> addQoList) {
        return ticketProblemPercentService.addTicketProblemPercent(addQoList);
    }

    @GetMapping("/list")
    public Wrapper<List<TicketProblemPercentVo>> listTicketProblemPercent(@RequestParam Integer ticketProblemInfoId) {
        return ticketProblemPercentService.listTicketProblemPercent(ticketProblemInfoId);
    }

    @PostMapping("/update")
    public Wrapper<Void> updateTicketProblemPercent(@RequestBody @Validated List<TicketProblemPercentUpdQo> updQoList) {
        return ticketProblemPercentService.updateTicketProblemPercent(updQoList);
    }

    @GetMapping("/scope")
    public Wrapper<Double> scopeTicketProblemPercent(@RequestParam Integer ticketProblemInfoId) {
        return ticketProblemPercentService.scopeTicketProblemPercent(ticketProblemInfoId);
    }

}
